package com.zxd.dao;

import com.zxd.entity.RoleRelation;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * RoleRelationDao
 * Created by 奕恒 on 2017/2/20 21:48.
 */
public interface RoleRelationDao extends JpaRepository<RoleRelation, Integer>, JpaSpecificationExecutor<RoleRelation> {

    @Query("select a from RoleRelation a where a.master.id = ?1")
    List<RoleRelation> findListByMasterId(Integer masterId);

    @Query("select a from RoleRelation a where a.role.id = ?1 group by a.master.id")
    List<RoleRelation> findListByRoleId(Integer roleId);
}